<!DOCTYPE html>
<script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script>
<script>

test(function() {
    window.performance.mark('mark1');
    window.performance.mark('mark2');
    window.performance.measure('measure1', 'mark1', 'mark2');

    var entries = window.performance.getEntries();
    for (var i = 0; i < entries.length; i++) {
        var entry = entries[i];
        var serialized = JSON.parse(JSON.stringify(entry));
        for (var attr in entry) {
            if (typeof entry[attr] != 'function') {
                var assertMethod = assert_equals
                if (Array.isArray(serialized[attr]) && Array.isArray(entry[attr])) {
                  assertMethod = assert_array_equals
                }
                assertMethod(serialized[attr], entry[attr], entry.constructor.name + '.' + attr);
            }
        }
    }
}, 'PerformanceEntry subclasses should serialize all attributes');

</script>
